#include<iostream>
#include<string>
#include<cstdlib>			//used for random
#include <ctime>			//used for time from random
#include <vector>
#include <cmath>
#include "Game.h"
#include "ConstantType.h"
#include "Path.h"
#include "Site.h"

namespace catan
{

	/* NOT USED	*/

//0=SOLDIER, 1=MONOPOLY, 2=ROADBUILDING, 3=YEAROFPLENTY, 4=MARKET, 5=LIBRARY, 6=UNIVERSITY, 7=GOVERNORSHOUSE, 8=CHAPEL
Game::Game(){
	srand((int)time(0));	//set the seed for random generation;
	numberOfPlayers = 0;
	std::vector<DevelopmentCard::Enum_DevelopmentCard> shuffledDevelopmentCards = DevelopmentCard::getVectorOfShuffledEnumValues();
	for (std::vector<DevelopmentCard::Enum_DevelopmentCard>::iterator shuffledDevelopmentCardIterator = shuffledDevelopmentCards.begin(); shuffledDevelopmentCardIterator != shuffledDevelopmentCards.end(); shuffledDevelopmentCardIterator++)
	{
		developmentDeck.push_back(DevelopmentCard(*shuffledDevelopmentCardIterator));
	}
}

std::vector<int> Game::rollDice(){
	std::vector<int> dice;
	dice.push_back(rand()%6+1);
	dice.push_back(rand()%6+1);
	return dice;
}

bool Game::isGameEnded(std::vector<Player> playerVector){
	bool continueRoundRobin = true;
	bool gameEnds = false;
	int index;	// the current player from the vector of players
	while(continueRoundRobin){
		for (index=0; index<static_cast<int>(playerVector.size()); index++){
			// the first player in the round robin order who have the MAXGAMEPOINTS will stop the round robin and this player is declared the winner
			if (playerVector[index].getVictoryPoints(false, false) >= MAXGAMEPOINTS){ 
				gameEnds = true;
				continueRoundRobin = false;
			}
		}
		continueRoundRobin = false;
	}
	return gameEnds;
}

void Game::buying(){
}



}